package org.apache.lorry.lettuce;


import io.lettuce.core.RedisClient;
import io.lettuce.core.api.StatefulRedisConnection;
import io.lettuce.core.api.sync.RedisCommands;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class LettuceHelloWorld {
    public static void main(String[] args) {
        RedisClient redisClient = RedisClient.create("redis://password@localhost:6379/0");
        StatefulRedisConnection<String, String> connection = redisClient.connect();
        RedisCommands<String, String> syncCommands = connection.sync();
//        syncCommands.set("key", "Hello, Redis!");
//        String value = syncCommands.get("key");
//
////        long invalue = syncCommands.incr("abc");
//        String longvalue = syncCommands.get("abc");
//        log.info("value : {} ", value);
////        log.info("invalue : {} ", invalue);
//        log.info("longvalue : {} ", longvalue);


        syncCommands.lpush("list1", "val1");
        syncCommands.lpush("list1", "val2");

        String value = syncCommands.rpop("list1");
        log.info("value : {} ", value);
    }


    public void testRedisList() {

    }
}
